#include<bits/stdc++.h>
using namespace std;
const int N=1005;
typedef long long LL;

int n;
int a[N];
int b[N];
bool visit[N];

int main(){
	scanf("%d",&n);
	for(int i=1;i<=n;i++){
		scanf("%d",&a[i]);
		b[i]=a[i];
	}
	sort(a+1,a+n+1);
	LL ans=0L;
	memset(visit,false,sizeof(visit));
	for(int i=1;i<=n;i++){
		ans+=(n-i)*a[i];
		for(int j=1;j<=n;j++){
			if(!visit[j]&&b[j]==a[i]){
				visit[j]=true;
				printf("%d ",j);
				break;
			}
		}
	}
	printf("\n%.2f",ans/(0.0+n));
	return 0;
}
